//
//  TwoAndThreeTableViewCell.m
//  LFCWarmSystem
//
//  Created by Kill on 16/4/28.
//  Copyright © 2016年 李福才. All rights reserved.
//

#import "TwoAndThreeTableViewCell.h"

@implementation TwoAndThreeTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _btnCall = [UIButton buttonWithType:UIButtonTypeCustom];
        [_btnCall setHidden:YES];
        [_btnCall addTarget:self action:@selector(ocClick:) forControlEvents:UIControlEventTouchUpInside];
        _btnCall.layer.cornerRadius = 5.0;
        [self addSubview:_btnCall];
        
        _btnSendMSG = [UIButton buttonWithType:UIButtonTypeCustom];
        [_btnSendMSG setHidden:YES];
        [_btnSendMSG addTarget:self action:@selector(ocClick:) forControlEvents:UIControlEventTouchUpInside];
        _btnSendMSG.layer.cornerRadius = 5.0;
        [self addSubview:_btnSendMSG];
        
        _textFieldLeft = [[UITextField alloc] init];
        _textFieldLeft.backgroundColor = TEXTFIELDCOLOR;
        _textFieldLeft.layer.cornerRadius = 5.0;
        _textFieldLeft.textColor = [UIColor whiteColor];
        _textFieldLeft.placeholder = NSLocalizedString(@"PleaseEnterPhoneNum_Sample", @"  请输入电话号码");
        [_textFieldLeft setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
        [_textFieldLeft setValue:TEXTFONT forKeyPath:@"_placeholderLabel.font"];
        [_textFieldLeft setHidden:YES];
        [self addSubview:_textFieldLeft];
       
        _textField = [[UITextField alloc] init];
        _textField.backgroundColor = TEXTFIELDCOLOR;
        _textField.layer.cornerRadius = 5.0;
        _textField.textColor = [UIColor whiteColor];
        _textField.placeholder = NSLocalizedString(@"PleaseEnterPhoneNum_Sample", @"  请输入电话号码");
        [_textField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
        [_textField setValue:TEXTFONT forKeyPath:@"_placeholderLabel.font"];
        [_textField setHidden:YES];
        [self addSubview:_textField];
        self.layer.cornerRadius = 5.0;
        self.backgroundColor = TABLEVIEWCOLOR;
    }
    return self;
}


- (void)setFrame:(CGRect)frame {
    [super setFrame:frame];
    if (_btnCall) {
        _textFieldLeft.frame = CGRectMake(10*WIDTHSCALE, frame.size.height/8.0, frame.size.width-40*WIDTHSCALE-2*frame.size.height*3/4.0, frame.size.height*3/4.0);
        _btnCall.frame = CGRectMake(_textFieldLeft.frame.origin.x+_textFieldLeft.frame.size.width+10*WIDTHSCALE, frame.size.height/8.0, frame.size.height*3/4.0, frame.size.height*3/4.0);
        
        _btnSendMSG.frame = CGRectMake(_btnCall.frame.origin.x+_btnCall.frame.size.width+10*WIDTHSCALE, frame.size.height/8.0, frame.size.height*3/4.0, frame.size.height*3/4.0);
        _textField.frame = CGRectMake(10*WIDTHSCALE, frame.size.height/8.0, frame.size.width-10*2*WIDTHSCALE, frame.size.height*3/4.0);
    }
}

-(void)ocClick:(UIButton *)sender{
    [sender setSelected:!sender.isSelected];
}
@end
